home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / math / ast51src.zip / INTRPRET.C < prev    next >
C/C++ Source or Header  |  1995-12-31  |  23KB  |  662 lines

  1. /*
  2. ** Astrolog (Version 5.10) File: intrpret.c
  3. **
  4. ** IMPORTANT NOTICE: The graphics database and chart display routines
  5. ** used in this program are Copyright (C) 1991-1995 by Walter D. Pullen
  6. ** (Astara@msn.com). Permission is granted to freely use and
  7. ** distribute these routines provided one doesn't sell, restrict, or
  8. ** profit from them in any way. Modification is allowed provided these
  9. ** notices remain with any altered or edited versions of the program.
  10. **
  11. ** The main planetary calculation routines used in this program have
  12. ** been Copyrighted and the core of this program is basically a
  13. ** conversion to C of the routines created by James Neely as listed in
  14. ** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  15. ** available from Matrix Software. The copyright gives us permission to
  16. ** use the routines for personal use but not to sell them or profit from
  17. ** them in any way.
  18. **
  19. ** The PostScript code within the core graphics routines are programmed
  20. ** and Copyright (C) 1992-1993 by Brian D. Willoughby
  21. ** (brianw@sounds.wa.com). Conditions are identical to those above.
  22. **
  23. ** The extended accurate ephemeris databases and formulas are from the
  24. ** calculation routines in the program "Placalc" and are programmed and
  25. ** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
  26. ** (alois@azur.ch). The use of that source code is subject to
  27. ** regulations made by Astrodienst Zurich, and the code is not in the
  28. ** public domain. This copyright notice must not be changed or removed
  29. ** by any user of this program.
  30. **
  31. ** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
  32. ** X Window graphics initially programmed 10/23-29/1991.
  33. ** PostScript graphics initially programmed 11/29-30/1992.
  34. ** Last code change made 12/27/1995.
  35. */
  36.  
  37. #include "astrolog.h"
  38.  
  39.  
  40. #ifdef INTERPRET
  41. /*
  42. ******************************************************************************
  43. ** Interpretation Routines.
  44. ******************************************************************************
  45. */
  46.  
  47. /* This function is used by the interpretation routines to print out lines  */
  48. /* of text with newlines inserted just before the end of screen is reached. */
  49.  
  50. void FieldWord(sz)
  51. char *sz;
  52. {
  53.   static char line[cchSzMax];
  54.   static int cursor = 0;
  55.   int i, j;
  56.  
  57.   /* Hack: Dump buffer if function called with a null string. */
  58.  
  59.   if (sz == NULL) {
  60.     line[cursor] = 0;
  61.     PrintSz(line); PrintL();
  62.     cursor = 0;
  63.     return;
  64.   }
  65.   if (cursor)
  66.     line[cursor++] = ' ';
  67.   for (i = 0; (line[cursor] = sz[i]); i++, cursor++)
  68.     ;
  69.  
  70.   /* When buffer overflows 'n' columns, display one line and start over. */
  71.  
  72.   while (cursor >= us.nScreenWidth-1) {
  73.     for (i = us.nScreenWidth-1; line[i] != ' '; i--)
  74.       ;
  75.     line[i] = 0;
  76.     PrintSz(line); PrintL();
  77.     line[0] = line[1] = ' ';
  78.     for (j = 2; (line[j] = line[i+j-1]) != 0; j++)
  79.       ;
  80.     cursor -= (i-1);
  81.   }
  82. }
  83.  
  84.  
  85. /* Display a general interpretation of what each sign of the zodiac, house, */
  86. /* and planet or object means. This is called to do the -I0 switch table.   */
  87.  
  88. void InterpretGeneral()
  89. {
  90.   char sz[cchSzDef*2];
  91.   int i;
  92.  
  93.   PrintSz("Signs of the zodiac represent psychological characteristics.\n\n");
  94.   for (i = 1; i <= cSign; i++) {
  95.     AnsiColor(kSignA(i));
  96.     sprintf(sz, "%s is", szSignName[i]); FieldWord(sz);
  97.     sprintf(sz, "%s, and", szDesc[i]); FieldWord(sz);
  98.     sprintf(sz, "%s.", szDesire[i]); FieldWord(sz);
  99.     FieldWord(NULL);
  100.   }
  101.   AnsiColor(kDefault);
  102.   PrintSz("\nHouses represent different areas within one's life.\n\n");
  103.   for (i = 1; i <= cSign; i++) {
  104.     AnsiColor(kSignA(i));
  105.     sprintf(sz, "The %d%s House is the area of life dealing with",
  106.       i, szSuffix[i]); FieldWord(sz);
  107.     sprintf(sz, "%s.", szLifeArea[i]); FieldWord(sz);
  108.     FieldWord(NULL);
  109.   }
  110.   AnsiColor(kDefault);
  111.   PrintSz("\nPlanets represent various parts of one's mind or self.\n\n");
  112.   for (i = 1; i <= cObjInt; i++) {
  113.     if (ignore[i] || FCusp(i))
  114.       continue;
  115.     AnsiColor(kObjA[i]);
  116.     if (i <= oMoo || (FBetween(i, oNod, oCore)) && (i != oLil || fSouthNode))
  117.       FieldWord("The");
  118.     sprintf(sz, "%s%s%s represents one's",
  119.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  120.       i == 13 ? " Athena" : ""); FieldWord(sz);
  121.     sprintf(sz, "%s.", szMindPart[i]); FieldWord(sz);
  122.     FieldWord(NULL);
  123.   }
  124.   AnsiColor(kDefault);
  125. }
  126.  
  127.  
  128. /* Display a general interpretation of what each aspect type means. This */
  129. /* is called when printing the interpretation table in the -I0 switch.   */
  130.  
  131. void InterpretAspectGeneral()
  132. {
  133.   char sz[cchSzDef*2];
  134.   int i;
  135.  
  136.   PrintSz("\nAspects are different relationships between planets.\n\n");
  137.   for (i = 1; i <= Min(us.nAsp, cAspectInt); i++) {
  138.     AnsiColor(kAspA[i]);
  139.     sprintf(sz, "When planets are %s, one", szAspectName[i]);
  140.     FieldWord(sz); sprintf(sz, szInteract[i], ""); FieldWord(sz);
  141.     FieldWord("another.");
  142.     if (szTherefore[i][0]) {
  143.       sprintf(sz, "%s.", szTherefore[i]); FieldWord(sz);
  144.     }
  145.     FieldWord(NULL);
  146.   }
  147.   return;
  148. }
  149.  
  150.  
  151. /* Print the interpretation of each planet in sign and house, as specified */
  152. /* with the -I switch. This is basically array accessing combining the     */
  153. /* meanings of each planet, sign, and house, and a couple of other things. */
  154.  
  155. void InterpretLocation()
  156. {
  157.   char sz[cchSzDef*2], c;
  158.   int i, j;
  159.  
  160.   PrintL();
  161.   for (i = 1; i <= cObjInt; i++) {
  162.     if (ignore[i] || FCusp(i))
  163.       continue;
  164.     AnsiColor(kObjA[i]);
  165.     j = SFromZ(planet[i]); c = Dignify(i, j);
  166.     sprintf(sz, "%s%s%s%s in %s", ret[i] < 0.0 ? "Retrograde " : "",
  167.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  168.       i == 13 ? " Athena" : "", szSignName[j]);
  169.     FieldWord(sz);
  170.     sprintf(sz, "and %d%s House:", inhouse[i], szSuffix[inhouse[i]]);
  171.     FieldWord(sz);
  172.     FieldWord("This person's"); FieldWord(szMindPart[i]); FieldWord("is");
  173.     if (((int)planet[i]) % 30 < 10)
  174.       FieldWord("very");
  175.     sprintf(sz, "%s, and", szDesc[j]); FieldWord(sz);
  176.     sprintf(sz, "%s.", szDesire[j]); FieldWord(sz);
  177.     FieldWord("Most often this manifests");
  178.     if (ret[i] < 0.0 && i != oNod)
  179.       FieldWord("in an independent, backward, introverted manner, and");
  180.     FieldWord("in the area of life dealing with");
  181.     sprintf(sz, "%s.", szLifeArea[inhouse[i]]); FieldWord(sz);
  182.  
  183.     /* Extra information if planet is in its ruling, falling, etc, sign. */
  184.  
  185.     if (c == 'R')
  186.       FieldWord("This is a major aspect of the person's psyche!");
  187.     else if (c == 'F')
  188.       FieldWord("(This bit plays only a minor part in the person's psyche.)");
  189.     else if (c == 'e')
  190.       FieldWord("It is easy for them to express this part of themself.");
  191.     else if (c == 'd')
  192.       FieldWord("It is difficult for them to express this part of themself.");
  193.     FieldWord(NULL);
  194.   }
  195. }
  196.  
  197.  
  198. /* Print an interpretation for a particular aspect in effect in a chart. */
  199. /* This is called from the InterpretGrid and ChartAspect routines.       */
  200.  
  201. void InterpretAspect(x, y)
  202. int x, y;
  203. {
  204.   char sz[cchSzDef*2];
  205.   int n;
  206.  
  207.   n = grid->n[x][y];
  208.   if (n < 1 || n > cAspectInt ||
  209.     FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  210.     return;
  211.   AnsiColor(kAspA[n]);
  212.   sprintf(sz, "%s %s %s: This person's", szObjName[x],
  213.     szAspectName[n], szObjName[y]);
  214.   FieldWord(sz); FieldWord(szMindPart[x]);
  215.   sprintf(sz, szInteract[n],
  216.     szModify[Min(abs(grid->v[x][y])/150, 2)][n-1]);
  217.   FieldWord(sz);
  218.   sprintf(sz, "their %s.", szMindPart[y]); FieldWord(sz);
  219.   if (szTherefore[n][0]) {
  220.     sprintf(sz, "%s.", szTherefore[n]); FieldWord(sz);
  221.   }
  222.   FieldWord(NULL);
  223. }
  224.  
  225.  
  226. /* Print the interpretation of each aspect in the aspect grid, as specified */
  227. /* with the -g -I switch. Again, this is done by basically array accessing  */
  228. /* of the meanings of the two planets in aspect and of the aspect itself.   */
  229.  
  230. void InterpretGrid()
  231. {
  232.   int i, j;
  233.  
  234.   for (i = 1; i < cObjInt; i++) if (!ignore[i] && !FCusp(i))
  235.     for (j = i+1; j <= cObjInt; j++) if (!ignore[j] && !FCusp(i))
  236.       InterpretAspect(i, j);
  237. }
  238.  
  239.  
  240. /* Print an interpretation for a particular midpoint in effect in a chart. */
  241. /* This is called from the ChartMidpoint routine.                          */
  242.  
  243. void InterpretMidpoint(x, y)
  244. int x, y;
  245. {
  246.   char sz[cchSzDef*2];
  247.   int n, i;
  248.  
  249.   if (FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  250.     return;
  251.   n = grid->n[y][x];
  252.   AnsiColor(kSignA(n));
  253.   sprintf(sz, "%s midpoint %s in %s: The merging of the person's",
  254.     szObjName[x], szObjName[y], szSignName[n]);
  255.   FieldWord(sz); FieldWord(szMindPart[x]);
  256.   FieldWord("with their"); FieldWord(szMindPart[y]);
  257.   FieldWord("is");
  258.   if (grid->v[y][x]/60 < 10)
  259.     FieldWord("very");
  260.   sprintf(sz, "%s, and", szDesc[n]); FieldWord(sz);
  261.   sprintf(sz, "%s.", szDesire[n]); FieldWord(sz);
  262.   FieldWord("Most often this manifests in");
  263.   if (ret[x]+ret[y] < 0.0 && x != oNod && y != oNod)
  264.     FieldWord("an independent, backward, introverted manner, and");
  265.   FieldWord("the area of life dealing with");
  266.   i = HousePlaceIn(ZFromS(n) + (real)grid->v[y][x]/60.0);
  267.   sprintf(sz, "%s.", szLifeArea[i]); FieldWord(sz);
  268.   FieldWord(NULL);
  269. }
  270.  
  271.  
  272. /* This is a subprocedure of ChartInDay(). Print the interpretation for   */
  273. /* a particular instance of the various exciting events that can happen.  */
  274.  
  275. void InterpretInDay(source, aspect, dest)
  276. int source, aspect, dest;
  277. {
  278.   char sz[cchSzDef*2];
  279.  
  280.   if (source > cObjInt || dest > cObjInt)
  281.     return;
  282.  
  283.   /* Interpret object changing direction. */
  284.  
  285.   if (aspect == aDir) {
  286.     AnsiColor(kObjA[source]);
  287.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  288.     FieldWord("will tend to manifest in");
  289.     FieldWord(dest ? "an independent, backward, introverted" :
  290.       "the standard, direct, open");
  291.     FieldWord("manner.");
  292.     FieldWord(NULL);
  293.  
  294.   /* Interpret object entering new sign. */
  295.  
  296.   } else if (aspect == aSig) {
  297.     AnsiColor(kObjA[source]);
  298.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  299.     sprintf(sz, "will be %s,", szDesc[dest]);
  300.     FieldWord(sz);
  301.     sprintf(sz, "and it %s.", szDesire[dest]); FieldWord(sz);
  302.     FieldWord(NULL);
  303.  
  304.   /* Interpret aspect between transiting planets. */
  305.  
  306.   } else if (aspect > 0 && aspect <= cAspectInt) {
  307.     AnsiColor(kAspA[aspect]);
  308.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  309.     sprintf(sz, szInteract[aspect], szModify[1][aspect-1]);
  310.     FieldWord(sz);
  311.     sprintf(sz, "energies of %s.", szMindPart[dest]); FieldWord(sz);
  312.     if (szTherefore[aspect][0]) {
  313.       if (aspect > aCon) {
  314.         sprintf(sz, "%s.", szTherefore[aspect]); FieldWord(sz);
  315.       } else
  316.         FieldWord("They will affect each other prominently.");
  317.     }
  318.     FieldWord(NULL);
  319.   }
  320. }
  321.  
  322.  
  323. /* This is a subprocedure of ChartTransit(). Print the interpretation for */
  324. /* a particular transit of a planet to a natal object of a chart.         */
  325.  
  326. void InterpretTransit(source, aspect, dest)
  327. int source, aspect, dest;
  328. {
  329.   char sz[cchSzDef*2];
  330.  
  331.   if (source <= oCore && dest <= oCore && aspect <= cAspectInt) {
  332.     AnsiColor(kAspA[aspect]);
  333.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  334.     sprintf(sz, szInteract[aspect], szModify[1][aspect-1]);
  335.     FieldWord(sz);
  336.     if (source != dest) {
  337.       sprintf(sz, "the person's %s.", szMindPart[dest]); FieldWord(sz);
  338.     } else
  339.       FieldWord("the same aspect inside the person's makeup.");
  340.     if (szTherefore[aspect][0]) {
  341.       if (aspect > aCon) {
  342.         sprintf(sz, "%s.", szTherefore[aspect]); FieldWord(sz);
  343.       } else
  344.         FieldWord("This part of their psyche will be strongly influenced.");
  345.     }
  346.     FieldWord(NULL);
  347.   }
  348. }
  349.  
  350.  
  351. /* Print the interpretation of one person's planet in another's sign and    */
  352. /* house, in a synastry chart as specified with the -r switch combined with */
  353. /* -I. This is very similar to the interpretation of the standard -v chart  */
  354. /* in InterpretLocation(), but we treat the chart as a relationship here.   */
  355.  
  356. void InterpretSynastry()
  357. {
  358.   char sz[cchSzDef*2], c;
  359.   int i, j;
  360.  
  361.   PrintL();
  362.   for (i = 1; i <= cObjInt; i++) {
  363.     if (ignore[i] || FCusp(i))
  364.       continue;
  365.     AnsiColor(kObjA[i]);
  366.     j = SFromZ(planet[i]); c = Dignify(i, j);
  367.     sprintf(sz, "%s%s%s%s in %s,", ret[i] < 0.0 ? "Retrograde " : "",
  368.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  369.       i == 13 ? " Athena" : "", szSignName[j]);
  370.     FieldWord(sz);
  371.     sprintf(sz, "in their %d%s House:", inhouse[i], szSuffix[inhouse[i]]);
  372.     FieldWord(sz);
  373.     FieldWord("Person1's"); FieldWord(szMindPart[i]); FieldWord("is");
  374.     if (((int)planet[i]) % 30 < 10)
  375.       FieldWord("very");
  376.     sprintf(sz, "%s, and", szDesc[j]); FieldWord(sz);
  377.     sprintf(sz, "%s.", szDesire[j]); FieldWord(sz);
  378.     FieldWord("This");
  379.     if (ret[i] < 0.0 && i != oNod)
  380.       FieldWord(
  381.         "manifests in an independent, backward, introverted manner, and");
  382.     FieldWord("affects Person2 in the area of life dealing with");
  383.     sprintf(sz, "%s.", szLifeArea[inhouse[i]]); FieldWord(sz);
  384.  
  385.     /* Extra information if planet is in its ruling, falling, etc, sign. */
  386.  
  387.     if (c == 'R')
  388.       FieldWord("This is a major aspect of Person1's psyche!");
  389.     else if (c == 'F')
  390.       FieldWord("(This bit plays only a minor part in Person1's psyche.)");
  391.     else if (c == 'e')
  392.       FieldWord("Person2 is affected harmoniously in this way.");
  393.     else if (c == 'd')
  394.       FieldWord("Person2 is affected discordantly in this way.");
  395.     FieldWord(NULL);
  396.   }
  397. }
  398.  
  399.  
  400. /* Print an interpretation for a particular aspect in effect in a comparison */
  401. /* relationship chart. This is called from the InterpretGridRelation and     */
  402. /* the ChartAspectRelation routines.                                         */
  403.  
  404. void InterpretAspectRelation(x, y)
  405. int x, y;
  406. {
  407.   char sz[cchSzDef*2];
  408.   int n;
  409.  
  410.   n = grid->n[y][x];
  411.   if (n < 1 || n > cAspectInt ||
  412.     FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  413.     return;
  414.   AnsiColor(kAspA[n]);
  415.   sprintf(sz, "%s %s %s: Person1's", szObjName[x],
  416.     szAspectName[n], szObjName[y]);
  417.   FieldWord(sz); FieldWord(szMindPart[x]);
  418.   sprintf(sz, szInteract[n],
  419.     szModify[Min(abs(grid->v[y][x])/150, 2)][n-1]);
  420.   FieldWord(sz);
  421.   sprintf(sz, "Person2's %s.", szMindPart[y]); FieldWord(sz);
  422.   if (szTherefore[n][0]) {
  423.     if (n != 1) {
  424.       sprintf(sz, "%s.", szTherefore[n]); FieldWord(sz);
  425.     } else
  426.       FieldWord("These parts affect each other prominently.");
  427.   }
  428.   FieldWord(NULL);
  429. }
  430.  
  431.  
  432. /* Print the interpretation of each aspect in the relationship aspect grid, */
  433. /* as specified with the -r0 -g -I switch combination.                      */
  434.  
  435. void InterpretGridRelation()
  436. {
  437.   int i, j;
  438.  
  439.   for (i = 1; i <= cObjInt; i++) if (!ignore[i])
  440.     for (j = 1; j <= cObjInt; j++) if (!ignore[j])
  441.       InterpretAspectRelation(i, j);
  442. }
  443.  
  444.  
  445. /* Print the interpretation of a midpoint in the relationship grid, as */
  446. /* specified with the -r0 -m -I switch combination.                    */
  447.  
  448. void InterpretMidpointRelation(x, y)
  449. int x, y;
  450. {
  451.   char sz[cchSzDef*2];
  452.   int n;
  453.  
  454.   if (FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  455.     return;
  456.   n = grid->n[y][x];
  457.   AnsiColor(kSignA(n));
  458.   sprintf(sz, "%s midpoint %s in %s: The merging of person1's",
  459.     szObjName[x], szObjName[y], szSignName[n]);
  460.   FieldWord(sz); FieldWord(szMindPart[x]);
  461.   FieldWord("with person2's"); FieldWord(szMindPart[y]);
  462.   FieldWord("is");
  463.   if (grid->v[y][x]/60 < 10)
  464.     FieldWord("very");
  465.   sprintf(sz, "%s, and", szDesc[n]); FieldWord(sz);
  466.   sprintf(sz, "%s.", szDesire[n]); FieldWord(sz);
  467.   if (cp1.dir[x]+cp2.dir[y] < 0.0 && x != oNod && y != oNod) {
  468.     FieldWord("Most often this manifests in");
  469.     FieldWord("an independent, backward, introverted manner.");
  470.   }
  471.   FieldWord(NULL);
  472. }
  473. #endif /* INTERPRET */
  474.  
  475.  
  476. /*
  477. ******************************************************************************
  478. ** Chart Influence Routines.
  479. ******************************************************************************
  480. */
  481.  
  482. /* This is a subprocedure of ChartInfluence(). Based on the values in the */
  483. /* array parameter 'value', store numbers in array 'rank' reflecting the  */
  484. /* relative order, e.g. value[x] 2nd greatest array value -> rank[x] = 2. */
  485.  
  486. void SortRank(value, rank, size)
  487. real *value;
  488. int *rank, size;
  489. {
  490.   int h, i, j, k;
  491.  
  492.   value[0] = -1.0;
  493.   for (i = 1; i <= size; i++)
  494.     rank[i] = -1;
  495.   for (h = 1, i = 0; h <= size; h++) {
  496.     if (size != cSign && (ignore[h] || !FThing(h)))
  497.       continue;
  498.     i++;
  499.     k = 0;
  500.     for (j = 1; j <= size; j++) {
  501.       if (size != cSign && (ignore[j] || !FThing(j)))
  502.         continue;
  503.       if (value[j] > value[k] && rank[j] < 0)
  504.         k = j;
  505.     }
  506.  
  507.     /* 'k' is the current position of the 'i'th place planet. */
  508.  
  509.     rank[k] = i;
  510.   }
  511. }
  512.  
  513.  
  514. /* Print out a list of power values and relative rankings, based on the */
  515. /* placements of the planets, and their aspects in the aspect grid, as  */
  516. /* specified with the -j "find influences" switch.                      */
  517.  
  518. void ChartInfluence()
  519. {
  520.   real power[oNorm+1], power1[oNorm+1], power2[oNorm+1],
  521.     total, total1, total2, x;
  522.   int rank[oNorm+1], rank1[oNorm+1], rank2[oNorm+1], i, j, k, l;
  523.   char sz[cchSzDef], c;
  524.  
  525.   for (i = 1; i <= oNorm; i++)
  526.     power1[i] = power2[i] = 0.0;
  527.   total = total1 = total2 = 0.0;
  528.  
  529.   /* First, for each object, find its power based on its placement alone. */
  530.  
  531.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  532.     j = SFromZ(planet[i]);
  533.     power1[i] += rObjInf[i];               /* Influence of planet itself. */
  534.     power1[i] += rHouseInf[inhouse[i]];    /* Influence of house it's in. */
  535.     c = Dignify(i, j);
  536.     switch (c) {
  537.     case 'R': x = rObjInf[oNorm+1]; break; /* Planets in signs they rule / */
  538.     case 'e': x = rObjInf[oNorm+2]; break; /* exalted in have influence.   */
  539.     default:  x = 0.0;
  540.     }
  541.     c = Dignify(i, inhouse[i]);
  542.     switch (c) {
  543.     case 'R': x += rHouseInf[cSign+1]; break; /* Item in house aligned with */
  544.     case 'e': x += rHouseInf[cSign+2]; break; /* sign ruled has influence.  */
  545.     default: ;
  546.     }
  547.     power1[i] += x;
  548.     if (i != rules[j])                       /* The planet ruling the sign */
  549.       power1[rules[j]] += rObjInf[i]/2.0;    /* and the house that the     */
  550.     if (i != (j = rules[inhouse[i]]))        /* current planet is in, gets */
  551.       power1[j] += rObjInf[i]/2.0;           /* extra influence.           */
  552.   }
  553.   for (i = 1; i <= cSign; i++) {         /* Various planets get influence */
  554.     j = SFromZ(house[i]);                /* if house cusps fall in signs  */
  555.     power1[rules[j]] += rHouseInf[i];    /* they rule.                    */
  556.   }
  557.  
  558.   /* Second, for each object, find its power based on aspects it makes. */
  559.  
  560.   if (!FCreateGrid(fFalse))
  561.     return;
  562.   for (j = 1; j <= oNorm; j++) if (!ignore[j] && FThing(j))
  563.     for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i) && i != j) {
  564.       k = grid->n[Min(i, j)][Max(i, j)];
  565.       if (k) {
  566.         l = grid->v[Min(i, j)][Max(i, j)];
  567.         power2[j] += rAspInf[k]*rObjInf[i]*
  568.           (1.0-RAbs((real)l)/60.0/rAspOrb[k]);
  569.       }
  570.     }
  571.  
  572.   /* Calculate total power of each planet. */
  573.  
  574.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  575.     power[i] = power1[i]+power2[i]; total1 += power1[i]; total2 += power2[i];
  576.   }
  577.   total = total1+total2;
  578.  
  579.   /* Finally, determine ranks of the arrays, then print everything out. */
  580.  
  581.   SortRank(power1, rank1, oNorm); SortRank(power2, rank2, oNorm);
  582.   SortRank(power, rank, oNorm);
  583.   PrintSz("  Planet:    Position      Aspects    Total Rank  Percent\n");
  584.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  585.     AnsiColor(kObjA[i]);
  586.     sprintf(sz, "%8.8s: ", szObjName[i]); PrintSz(sz);
  587.     sprintf(sz, "%6.1f (%2d) +%6.1f (%2d) =%7.1f (%2d) /%6.1f%%\n",
  588.       power1[i], rank1[i], power2[i], rank2[i],
  589.       power[i], rank[i], power[i]/total*100.0); PrintSz(sz);
  590.   }
  591.   AnsiColor(kDefault);
  592.   sprintf(sz, "   Total: %6.1f      +%6.1f      =%7.1f      / 100.0%%\n",
  593.     total1, total2, total); PrintSz(sz);
  594.  
  595.   /* Now, print out a list of power values and relative rankings, based on  */
  596.   /* the power of each sign of the zodiac, as indicated by the placement of */
  597.   /* the planets above, in the chart, as specified with the -j0 switch.     */
  598.  
  599.   if (!us.fInfluenceSign)
  600.     return;
  601.   for (i = 1; i <= cSign; i++)
  602.     power1[i] = 0.0;
  603.  
  604.   /* For each sign, determine its power based on the power of the object. */
  605.  
  606.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  607.     power1[SFromZ(planet[i])] += power[i] / 2.0;
  608.     power1[inhouse[i]]        += power[i] / 4.0;
  609.     power1[ruler1[i]]         += power[i] / 3.0;
  610.     if (ruler2[i])
  611.       power1[ruler2[i]]       += power[i] / 4.0;
  612.   }
  613.   if (!fSouthNode && !ignore[oNod]) {
  614.     power1[Mod12(SFromZ(planet[oNod])+6)] += power[oNod] / 2.0;  /* South */
  615.     power1[Mod12(inhouse[oNod]+6)]        += power[oNod] / 4.0;  /* Node. */
  616.   }
  617.   for (i = cThing+1; i <= oCore; i++) if (!ignore[i]) {
  618.     power1[SFromZ(planet[i])] += rObjInf[i];
  619.   }
  620.  
  621.   total1 = 0.0;
  622.   for (i = 1; i <= cSign; i++)
  623.     total1 += power1[i];
  624.   for (i = 1; i <= cSign; i++)
  625.     power1[i] *= total/total1;
  626.   total1 = total;
  627.  
  628.   /* Again, determine ranks in the array, and print everything out. */
  629.  
  630.   SortRank(power1, rank1, cSign);
  631.   PrintSz(
  632.     "\n       Sign:  Power Rank  Percent  -   Element  Power  Percent\n");
  633.   for (i = 1; i <= cSign; i++) {
  634.     AnsiColor(kSignA(i));
  635.     sprintf(sz, "%11.11s: ", szSignName[i]); PrintSz(sz);
  636.     sprintf(sz, "%6.1f (%2d) /%6.1f%%",
  637.       power1[i], rank1[i], power1[i]/total1*100.0); PrintSz(sz);
  638.     if (i <= 4) {
  639.       sprintf(sz, "  -%9.7s:", szElem[i-1]); PrintSz(sz);
  640.       total2 = 0.0;
  641.       for (j = 1; j < cSign; j += 4)
  642.         total2 += power1[i-1+j];
  643.       sprintf(sz, "%7.1f /%6.1f%%", total2, total2/total1*100.0); PrintSz(sz);
  644.     } else if (i == 6) {
  645.       AnsiColor(kDefault);
  646.       PrintSz("  -      Mode  Power  Percent");
  647.     } else if (i >= 7 && i <= 9) {
  648.       AnsiColor(kModeA(i-7));
  649.       sprintf(sz, "  -%9.8s:", szMode[i-7]); PrintSz(sz);
  650.       total2 = 0.0;
  651.       for (j = 1; j < cSign; j += 3)
  652.         total2 += power1[i-7+j];
  653.       sprintf(sz, "%7.1f /%6.1f%%", total2, total2/total1*100.0); PrintSz(sz);
  654.     }
  655.     PrintL();
  656.   }
  657.   AnsiColor(kDefault);
  658.   sprintf(sz, "      Total:%7.1f      / 100.0%%\n", total1); PrintSz(sz);
  659. }
  660.  
  661. /* intrpret.c */
  662.